import requests
import re
from base64 import b64decode
from PIL import Image
import paddleocr
import matplotlib.pyplot as plt
import numpy as np

answer = {
    1:0,2:11,3:21,4:300,5:311,6:321,7:600,8:611,9:621
    }
headers = {
    "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36"
}
url = "https://match.yuanrenxue.cn/api/match/8_verify"
response = requests.get(url, headers=headers)
string1 = response.json()['html']
# ---------------------图片保存
select_w = re.findall('<p>(.)</p>',string1)
select_w = ','.join(select_w)
print(select_w)
pattern = r'base64,([^\"]+)'
match = re.search(pattern, string1)
if match:
    base64_data = match.group(1)
    with open(r'E:\Python\vscode\Crawlers\yuanrenxue\no8\org_image.jpg','wb') as f:
        f.write(b64decode(base64_data))
else:
    print("未找到Base64编码数据")




